<template>
  <div class="distribute-rule-main">
    <div class="nav-back-header">
      <div class="back-title">
        <div class="back-button">
          <img
            class="back-cover"
            src="@/assets/images/arrow-left.png"
            @click="onNavigationBack()"
          />
        </div>
        <strong>设置群聊分发</strong>
      </div>
    </div>
    <div class="distribute-group-wrap">
      <div class="group-left">
        <div class="title">企微号</div>
        <div class="head-search">
          <el-input
            class="search-input"
            size="small"
            placeholder="搜手机号"
            suffix-icon="el-icon-search"
          />
        </div>
        <div class="list">
          <div class="wechat-item">
            <div class="account-wrap">
              <img
                class="account-cover"
                src="https://wework.qpic.cn/wwpic/177031_HhrnVYv6QQSgQ2C_1686909054/0"
              />
              <div class="account-info">
                <div class="account-name">闵雨薇</div>
                <div class="account-company">志新</div>
              </div>
            </div>
            <div class="desc">不分配</div>
          </div>
        </div>
      </div>
      <div class="group-right">
        <div class="title">分配规则</div>
        <el-form
          ref="form"
          :model="form"
          label-width="130px"
          class="form-body"
          label-position="left"
        >
          <el-form-item label="群聊是否分配：" prop="pass">
            <el-radio-group v-model="form.radio">
              <el-radio :label="0">不分配</el-radio>
              <el-radio :label="1">分配</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item label="分配的群聊：" prop="group">
            <el-radio-group v-model="form.group">
              <el-radio :label="0">不分配</el-radio>
              <el-radio :label="1">分配</el-radio>
            </el-radio-group>
          </el-form-item>
          <!-- <el-form-item label="选择现有群：" prop="group">
            
          </el-form-item> -->
          <el-form-item label="选择现有群：" prop="">
            <div class="bg_f7f7f7 p-16 flex flexwrap aligncenter">
              <el-button @click="handleClientGroup" class="mr-10"
                >选择客户群</el-button
              >
              <div
                class="flex flexwrap aligncenter line_h_22"
                style="max-width: 588px"
              >
                <div class="mr-4 userimg">
                  <img
                    src="//wework.qpic.cn/wwpic3az/653052_xhlEXu_pS7KOWcC_1709743954/0"
                    alt=""
                    class="userimg"
                  />
                </div>
                <span class="plr-6 c_primary"> 5 </span>个客户
              </div>
            </div>
          </el-form-item>

          <el-form-item label="符合条件的新群：" prop="pass">
            <span>
              <el-switch v-model="isChecked" size="small" />
              加入新群满5分钟判断，符合条件的群自动加入分发
            </span>
            <div v-if="isChecked" class="formbox p-16">
              <div style="width: 510px">
                <group-form2 labelposition="left" />
              </div>
              <div class="exclude mt-20">
                <el-checkbox v-model="form.checked">
                  <span class="c_text">排除符合以下条件的客户群</span>
                </el-checkbox>
              </div>
              <div v-if="form.checked" style="width: 510px">
                <group-form2 labelposition="left" />
              </div>
            </div>
          </el-form-item>
        </el-form>
        <div class="form-footer">
          <el-button size="small" plain>取消</el-button>
          <el-button size="small" type="primary">保存</el-button>
        </div>
      </div>
    </div>

    <!-- 选择客户群 -->
    <select-client-group-drawer
      v-if="showclientgroup"
      :visable.sync="showclientgroup"
      width="860px"
      :showRight="false"
    />
  </div>
</template>
<script>
import SelectClientGroupDrawer from "@/components/UserGroupComp/SelectClientGroupDrawer";
import GroupForm2 from "@/components/UserGroupComp/components/GroupForm2.vue";
export default {
  data() {
    return {
      form: {
        radio: 0,
        type: 0,
        groupRule: 0,
      },
      company: [
        { id: 1, name: "锐行" },
        { id: 2, name: "志新" },
      ],
      options: [
        {
          value: "1",
          label: "分组一",
        },
        {
          value: "2",
          label: "分组二",
        },
        {
          value: "3",
          label: "分组三",
        },
      ],
      value: "",
      showclientgroup: false,
      isChecked: false,
    };
  },
  components: {
    SelectClientGroupDrawer,
    GroupForm2,
  },
  methods: {
    onNavigationBack() {
      this.$router.go(-1);
    },

    handleClientGroup() {
      this.showclientgroup = true;
    },
  },
};
</script>
<style lang="scss" scoped>
.distribute-rule-main {
  width: 100%;
  height: calc(100% - 70px);
  .nav-back-header {
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 8;
    height: 46px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid #e9e9e9;
    .back-title {
      display: flex;
      align-items: center;
      font-size: 14px;
      line-height: 22px;
      .back-button {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        margin-right: 12px;
        border: none;
        width: 24px;
        height: 24px;
        background: #4b5a95;
        border-radius: 12px;
        cursor: pointer;
        .back-cover {
          width: 16px;
          height: 16px;
        }
      }
    }
  }
  .distribute-group-wrap {
    display: flex;
    height: 100%;
    width: 100%;
    margin: 12px 12px 0;
    background: #fff;
    .title {
      height: 48px;
      background: #fff;
      border-bottom: 1px solid #e9e9e9;
      display: flex;
      align-items: center;
      padding-left: 12px;
      font-size: 14px;
      font-family: PingFangSC-Semibold, PingFang SC;
      font-weight: 600;
      color: rgba(0, 0, 0, 0.85);
    }
    .group-left {
      flex: 400px 0;
      border-right: 1px solid #e9e9e9;
      height: 100%;
      .head-search {
        padding: 10px 12px;
        color: #222333;
        border-bottom: 1px solid #f4f4f4;
        display: flex;
        align-items: center;
      }
      .list {
        position: relative;
        .wechat-item {
          height: 72px;
          width: 100%;
          padding: 20px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          .account-wrap {
            display: flex;
            align-items: center;
            .account-cover {
              width: 40px;
              height: 40px;
            }
            .account-info {
              margin-left: 8px;
              .account-name {
                font-size: 14px;
                line-height: 22px;
              }
              .account-company {
                color: rgb(136, 137, 153);
                margin-top: 2px;
                line-height: 16px;
                font-size: 12px;
              }
            }
          }
          .desc {
            font-size: 12px;
            font-weight: 400;
            color: rgba(0, 0, 0, 0.45);
            text-align: right;
          }
        }
      }
    }
    .group-right {
      width: calc(100% - 400px);
      .form-body {
        position: relative;
        padding: 24px 24px 86px;
        overflow-x: hidden;
        overflow-y: auto;
        width: 100%;
        height: 100%;
      }
    }
  }
}
.form-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  border-top: 1px solid #eee;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
}
.userimg {
  width: 32px;
  height: 32px;
  background-color: #ccc;
  overflow: hidden;
  border-radius: 2px;
}
.formbox {
  border: 1px solid #e9e9e9;
}
.exclude {
  border-top: 1px solid #e9e9e9;
  padding: 10px 0;
}
</style>